import FormData from "form-data";
import axios from "axios";

export default function buildEndUploadBundle() {
  return {
    name: "uploadBundle", // this name will show up in warnings and errors
    async writeBundle() {
      const formData = new FormData();
      const filePath = path.join(process.cwd(), "/dist/index.js");
      // 构建完成后读取本地文件
      formData.append("files[]", fs.createReadStream(filePath));
      const formHeaders = formData.getHeaders();
      // const { code } = await axios.post("xxxx.com/upload", formData, {
      //   headers: {
      //     ...formHeaders,
      //   },
      // });
      if (code) {
        // 调用钉钉通知
      }
    },
  };
}
